#pragma once
#include "BWAPI.h"
#include <fstream>
#include <time.h>
#include <hash_map>

using namespace BWAPI;
using namespace std;
using namespace stdext;

enum Observation{DONT_SEE, SEE_FAR, SEE_NEAR};
enum Action{ATTACK, ESCAPE, NOTHING};
enum State{UNDER_ATTACK, NOT_UNDER_ATTACK};

enum UnitStatus{IDLE, WORKING, IN_BATTLE};
enum BattleLandMarkDist{FAR_AWAY, MID, CLOSE};
enum LandmarkHealth{HIGH, MID_HEALTH, LOW};

struct DataRow 
{
	//Time at end of step
	int gameTime;
	int unitID;
	Observation observation;
	Action action;
	State state;
	//Position of final tick in step
	int posX; 
	int posY;
	int unitHealth;
	bool isLandmark;
	string landmark;
	string unitType;
	UnitStatus status;

	BattleLandMarkDist battleLandmark;
	LandmarkHealth landmarkHealth;

};

class ExtractData2
{
private:
	string _outputDirectory;
	vector<string> _unitTypes;
	int _timeStepDuration;
	clock_t _lastTime;
	float _countdown;
	list<DataRow> _finalRows;
	hash_map<int, DataRow> _currentRows;
public:
	ExtractData2(void);
	ExtractData2(string outputDirectory, vector<string> unitTypes, int timeStepDuration);
	void Tick();
	void Save();
	void CurrentRowsToFinalRows();
};

